package com.wys.runner;

import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;

//@Component
public class MyApplicationRunner implements ApplicationRunner {
	@Override
	public void run(ApplicationArguments args) throws Exception {
		System.out.println("ApplicationRunner");
		// --k1=v1 k2=v2
		System.out.println(args.getNonOptionArgs());	// k2=v2	获取到没有横线的参数
		for (String sourceArg : args.getSourceArgs()) {	// 两个都可以拿到
			System.out.println(sourceArg);
		}
		System.out.println(args.getOptionNames());	// k1=v1	获取到有横线的参数
		System.out.println(args.getOptionValues("k1"));
	}
}
